import { defineStore } from 'pinia';

/**
 * theme 主题管理模块
 * 切换主题
 */
export const useThemeStore = defineStore('theme', {
    state: () => ({
        logoUrl:  new URL('@/assets/images/logo.png', import.meta.url).href,
        dayOrNight: false  // 默认白天
    }),
    actions: {
        toggleTheme() {
            this.dayOrNight = !this.dayOrNight;
            if (this.dayOrNight) {
                // 切换到夜晚模式
                this.logoUrl = new URL('@/assets/images/logo.png', import.meta.url).href;
            } else {
                // 切换到白天模式
                this.logoUrl = new URL('@/assets/images/logo.png', import.meta.url).href;
            }
        }
    }
});
